<template>
  <div class="breadItem">
    <!-- ==={{ to }} -->
    <template v-if="to">
      <router-link :to="to">
        <slot></slot>
      </router-link>
      <span>{{ separator }}</span>
    </template>

    <template v-else>
      <slot></slot>
      <span>{{ separator }}</span>
    </template>
  </div>
</template>

<script>
export default {
  name: 'MyBreadItem',
  data () {
    return {

    }
  },
  inject: ['separator'],
  props: {
    to: [String, Object]//表示传递的数据类型是对象或者字符串
  },
  created () {
  },
  computed: {
  },
  methods: {
  }
}
</script>
<style lang='scss'  scoped>
.breadItem {
  span {
    margin: 0 5px;
  }

  &:last-child {
    span {
      display: none;
    }
  }
}
</style>